﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Catalog_preview_json.aspx.cs" Inherits="newBlog.CenterInc.view_json.admin.Catalog_preview_json" %>
<%@ Import Namespace="newBlog.CenterInc.Ctrltor" %>
<%@ Import Namespace="newBlog.CenterInc.model" %>
<%@ Import Namespace="System.Web.Script.Serialization" %>

<% 
    Response.ContentType = "application/json";
    if (Session["user_id"]==null) {
        Response.Write("{\"error\":\"您未登录本站\"}");
        return;
    }
    if (Convert.ToInt32(Session["user_grade"])!=1) { 
    Response.Write("{\"error\":\"您不是管理员\"}");
        return;
    }
    catalog_inc catalog_Inc = new catalog_inc();
    int count = catalog_Inc.CatalogListCount();
    List<catalog_Dao> list = catalog_Inc.CatalogList();
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    string json = "{\"code\":0,\"msg\":\"\",\"count\":"+count+",\"data\":"+serializer.Serialize(list)+"}";
    Response.Write(json);

    %>